﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KELT
{
    /// <summary>
    /// ColorPickerWindow.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class ColorPickerWindow : Window
    {
        private byte r, g, b;
        private TOOL mainContext;

        public ColorPickerWindow(TOOL mainContext)
        {
            this.mainContext = mainContext;
            InitializeComponent();

        }
        public Color getColor()
        {
            r = Byte.Parse(RText.Text);
            g = Byte.Parse(GText.Text);
            b = Byte.Parse(BText.Text);
            return Color.FromRgb(r,g,b);
        }

        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            Color color = getColor();
            mainContext.background.Fill = new SolidColorBrush(color);
            mainContext.cameraManager.pageList.ElementAt(mainContext.cameraManager.pageList.Count - 1).nowBackgroundColor= color;
            Close();
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

    }
}
